<template>
  <div>
    <panel :list="dataLists" :type="type" @on-click-item="openListDetail"></panel>
    <load-more v-if="showLoadMore" :show-loading="false" tip="暂无数据" background-color="#fbf9fe"></load-more>
    <divider v-if="dataLists.length > 4" style="font-size: 12px;color: #b2b2b2;padding: 10px 20px;">我也是有底线的</divider>
  </div>
</template>
<script>
  import {Panel, Divider, LoadMore} from 'Vux'
  export default {
    components: {
      Panel,
      Divider,
      LoadMore
    },
    props: {
      showLoadMore: Boolean,
      dataLists: Array
    },
    data(){
      return {
        type: "6"
      }
    },
    methods: {
      S4(){
        return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
      },
      getUUid(){
        return (this.S4() + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + "-" + this.S4() + this.S4() + this.S4());
      },
      openListDetail(list){
        this.$vux.loading.show({
          text: '加载中'
        });
        let time = new Date();
        let obj = {
          head: {
            tranDate: time.toLocaleDateString(),
            tranTime: time.toLocaleTimeString(),
            tranNo: this.getUUid(),
            funcFlag: "mitMobile"
          },
          body: {
            riskAssessNo: list.riskNo
          }
        };
        $.ajax("../ui/servlet/GCASServlet/minute", {
          method: "post",
          contentType: "text/json;charset=UTF-8",
          data: JSON.stringify(obj),
          success: (info) => {
            this.$vux.loading.hide();
            if (info.code === 400) {
              this.$emit('error', info.data);
              return
            } else {
              let data = JSON.parse(info);
              if (data.head.flag === "0") {
                let ajaxData = {
                  info: data.body,
                  list: list
                };
                this.$router.push({
                  path: "/listDetail",
                  query: ajaxData
                });
                this.$store.commit('CHANGE_TRANSITION', 'left');
                this.$store.commit('SAVE_WX_FLAG',data.body.bussinessInfo.isWxFlag)
              } else {
                this.$emit('error', data.head.desc);
              }
            }
          },
          error: () => {
            this.$emit('error', '请求数据延时');
          }
        })
      }
    },
    mounted(){
    }
  }
</script>
<style>
  .newLists > .hairline-top:before {
    height: 0 !important;
  }

  .newLists > .hairline-bottom:after {
    /*height:0!important;*/
  }
</style>
<style scoped>
  .newLists {
    padding-top: 0;
  }

  .list-title > .title {
    color: #333;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .nameFlagBtn {
    min-width: 44px !important;
    min-height: 40px !important;
    float: left;
  }

  .item-queryCode {
    color: #666;
    padding-left: 10px;
    float: left;
  }

  .item-status {
    color: #666;
    padding: 16px 0 0 10px;
    float: left;
  }
</style>
